Skip to content

Torch-Tensorrt Integration with LightningModule #20808

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 60 commits into from
Aug 15, 2025

Conversation

GdoongMathew
Copy link
Contributor

@GdoongMathew GdoongMathew commented May 10, 2025

What does this PR do?

Fixes #11438

Before submitting
  • Was this discussed/agreed via a GitHub issue? (not for typos and docs)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes? (if necessary)
  • Did you write any new necessary tests? (not for typos and docs)
  • Did you verify new and existing tests pass locally with your changes?
  • Did you list all the breaking changes introduced by this pull request?
  • Did you update the CHANGELOG? (not for typos, docs, test updates, or minor internal changes/refactors)

PR review

Anyone in the community is welcome to review the PR.
Before you start reviewing, make sure you have read the review guidelines. In short, see the following bullet-list:

Reviewer checklist
  • Is this pull request ready for review? (if not, please submit in draft mode)
  • Check that all items from Before submitting are resolved
  • Make sure the title is self-explanatory and the description concisely explains the PR
  • Add labels and milestones (and optionally projects) to the PR so it can be classified

📚 Documentation preview 📚: https://pytorch-lightning--20808.org.readthedocs.build/en/20808/

@github-actions github-actions bot added pl Generic label for PyTorch Lightning package dependencies Pull requests that update a dependency file labels May 10, 2025
@GdoongMathew GdoongMathew changed the title Torch-Tensorrt Integration with LightningModule WIP: Torch-Tensorrt Integration with LightningModule May 11, 2025
@GdoongMathew
Copy link
Contributor Author

Hi @Borda , friendly ping for a code review~

btw, I'm wondering if anyone could help me with the unittests during the ci, since there's compatibility problem when testing with the oldest torch 2.1.2 and torch-tensorrt. I'd love to help with solving this problem if there's any suggestion.

@GdoongMathew GdoongMathew changed the title WIP: Torch-Tensorrt Integration with LightningModule Torch-Tensorrt Integration with LightningModule Jun 7, 2025
@GdoongMathew
Copy link
Contributor Author

I just saw that there's a utility script from https://raw.githubusercontent.com/Lightning-AI/utilities/main/scripts/adjust-torch-versions.py, which would figure out the mapping between torchvision, torchtext and torch, probably I could also add torch-tensorrt in the mapping as well ?

But I think extending the mapping only allow the lightning to install torch-tensorrt in most of the CICD jobs, but not necessarily solve the dependency missing issue in configuration python 3.12.7, torch 2.4.1.

@GdoongMathew
Copy link
Contributor Author

Somehow torch-tensorrt 2.4.0 for python 3.12 is only available in the pytorch index https://download.pytorch.org/whl/torch-tensorrt, but not in the PyPi.

@GdoongMathew
Copy link
Contributor Author

The failure in the GPU test is due to pytorch/TensorRT#3775

@github-actions github-actions bot added the ci Continuous Integration label Aug 13, 2025
@GdoongMathew
Copy link
Contributor Author

Hi @Borda , all jobs should be fixed now. I also changed a few things at c4d2263, please let me know if the change makes sense to you. Thanks ~

@GdoongMathew GdoongMathew requested a review from Borda August 14, 2025 10:39
@Borda Borda merged commit 39e24f5 into Lightning-AI:master Aug 15, 2025
105 checks passed
@GdoongMathew GdoongMathew deleted the feat/to_tensorrt branch August 15, 2025 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci Continuous Integration dependencies Pull requests that update a dependency file pl Generic label for PyTorch Lightning package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Integrate TorchTensorRt in order to increase speed during inference
2 participants